# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AndroidPublisher.V3.Model.RecurringExternalTransaction do
  @moduledoc """
  Represents a transaction that is part of a recurring series of payments. This can be a subscription or a one-time product with multiple payments (such as preorder).

  ## Attributes

  *   `externalSubscription` (*type:* `GoogleApi.AndroidPublisher.V3.Model.ExternalSubscription.t`, *default:* `nil`) - Details of an external subscription.
  *   `externalTransactionToken` (*type:* `String.t`, *default:* `nil`) - Input only. Provided during the call to Create. Retrieved from the client when the alternative billing flow is launched. Required only for the initial purchase.
  *   `initialExternalTransactionId` (*type:* `String.t`, *default:* `nil`) - The external transaction id of the first transaction of this recurring series of transactions. For example, for a subscription this would be the transaction id of the first payment. Required when creating recurring external transactions.
  *   `migratedTransactionProgram` (*type:* `String.t`, *default:* `nil`) - Input only. Provided during the call to Create. Must only be used when migrating a subscription from manual monthly reporting to automated reporting.
  *   `otherRecurringProduct` (*type:* `GoogleApi.AndroidPublisher.V3.Model.OtherRecurringProduct.t`, *default:* `nil`) - Details of a recurring external transaction product which doesn't belong to any other specific category.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :externalSubscription =>
            GoogleApi.AndroidPublisher.V3.Model.ExternalSubscription.t() | nil,
          :externalTransactionToken => String.t() | nil,
          :initialExternalTransactionId => String.t() | nil,
          :migratedTransactionProgram => String.t() | nil,
          :otherRecurringProduct =>
            GoogleApi.AndroidPublisher.V3.Model.OtherRecurringProduct.t() | nil
        }

  field(:externalSubscription, as: GoogleApi.AndroidPublisher.V3.Model.ExternalSubscription)
  field(:externalTransactionToken)
  field(:initialExternalTransactionId)
  field(:migratedTransactionProgram)
  field(:otherRecurringProduct, as: GoogleApi.AndroidPublisher.V3.Model.OtherRecurringProduct)
end

defimpl Poison.Decoder, for: GoogleApi.AndroidPublisher.V3.Model.RecurringExternalTransaction do
  def decode(value, options) do
    GoogleApi.AndroidPublisher.V3.Model.RecurringExternalTransaction.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AndroidPublisher.V3.Model.RecurringExternalTransaction do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
